package edu.xidian.bdilab.jrbigdata.controller.enterprise;

import edu.xidian.bdilab.jrbigdata.controller.response.ResponseResult;
import edu.xidian.bdilab.jrbigdata.service.enterprise.infoQuery.InfoQueryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName BankInfoController
 * @Description TODO
 * @Author JinLingming
 * @Date 2020/11/02 18:57
 * @Version 1.0
 **/
@RestController
@Api(tags = {"EnterpriseInfo-处理企业信息"})
public class EnterpriseInfoController {

    @Autowired
    InfoQueryService infoQueryService;

    @ResponseBody
    @ApiOperation("获取企业库")
    @RequestMapping(value = "enterprise/getAllEnterpriseInformation", method = RequestMethod.POST)
    public ResponseResult getAllBankInformation(@RequestParam(defaultValue = "1")@ApiParam(value = "页码") int pageNum,
                                                @RequestParam(defaultValue = "10")@ApiParam(value = "每页记录数") int pageSize,
                                                @RequestParam(required = false) @ApiParam(value = "统一社会信用代码（支持模糊查询）") String socialCode,
                                                @RequestParam(required = false) @ApiParam(value = "企业名称（支持模糊查询）") String enterpriseName,
                                                @RequestParam(required = false) @ApiParam(value = "法人姓名（支持模糊查询）")String ownerName,
                                                @RequestParam(required = false) @ApiParam(value = "街道乡镇（支持模糊查询）")String street,
                                                @RequestParam(required = false) @ApiParam(value = "法定代表人手机号码（支持模糊查询）")String ownerPhone,
                                                @RequestParam(required = false) @ApiParam(value = "联系人姓名（支持模糊查询）")String contactName,
                                                @RequestParam(required = false) @ApiParam(value = "联系人手机号码（支持模糊查询）")String contactPhone,
                                                @RequestParam(required = false) @ApiParam(value = "注册地址（支持模糊查询）")String establishAddress,
                                                @RequestParam(required = false) @ApiParam(value = "经营范围（支持模糊查询）")String businessScop,
                                                @RequestParam(required = false) @ApiParam(value = "企业详情（支持模糊查询）") String enterpriseDesc,
                                                @RequestParam(required = false) @ApiParam(value = "企业注册资本") Integer registeredCaptial,
                                                @RequestParam(required = false) @ApiParam(value = "所属区域")Integer region,
                                                @RequestParam(required = false) @ApiParam(value = "信保基金额度")Integer fundQuota,
                                                @RequestParam(required = false) @ApiParam(value = "可用额度")Integer available,
                                                @RequestParam(required = false) @ApiParam(value = "信用等级")Integer isCreditRate
    )throws Exception{
        ResponseResult responseResult=infoQueryService.getAllEnterpriseInfo(pageNum,pageSize,socialCode,enterpriseName,ownerName,street,ownerPhone,
                contactName,contactPhone,establishAddress,businessScop,enterpriseDesc,registeredCaptial,region,fundQuota,available,isCreditRate);
        return responseResult;
    }
}
